package net.cyndeline.rldungeon.dgs

import net.cyndeline.rldungeon.dgs.graph.{DGSFunctionality, DGSEdge, Room}
import scalax.collection.immutable.Graph
import scalax.collection.GraphEdge.UnDiEdge

/**
 * Updates room vertices by adding rewards to them, used when removing pointless areas from the map.
 *
 * Note: The pointless area algorithm doesn't take the result of the processor into consideration.
 * If you would rather rely on productions to add all rewards, you can instead supply an implementation that
 * "tags" the room with some token representing a reward, and then have a production replace it with the
 * actual thing.
 */
trait RewardProcessor[VType <: Room[VType], EType[X] <: UnDiEdge[X] with DGSFunctionality[X, EType]] {

  /**
   * Adds a reward to a room vertex.
   * @param room Room to add reward to.
   * @param graph Graph that the room belongs to.
   * @return A copy of the supplied room with a reward added to it.
   */
  def addReward(room: VType, graph: Graph[VType, EType]): VType

}
